using UnityEngine;

public class FloatingGold : MonoBehaviour
{
	public static FloatingGold instance;

	public GameObject _target;

	public Camera worldCamera;

	public Camera guiCamera;

	public bool isFloating = true;

	private Vector3 _pos;

	public void LateUpdate()
	{
		if (_target != null && isFloating)
		{
			_pos = worldCamera.WorldToViewportPoint(_target.transform.position);
			_pos = guiCamera.ViewportToWorldPoint(_pos);
			_pos.z = 0f;
			base.transform.position = _pos;
		}
	}
}
